Ext.regController('dbController', {
			
/*********************** FLIGHT TALK VIEW ***************************/
/**
* DESCRIPTION: get posts 
* PARAMETERS: 
* 		method - the selection criteria
* 			getFlightPost
* 			getFlightQuestion
* 			getTerminalPost
* 			getTerminalQuestion
* 			getLangPost
* 			getLangQuestion
* 			getMyPost
* 			getRecentBoredPost
* 			getPopularBoredPost
*       next - next page to display
*       list - list to display the posts
* RESULT: populate the provided list with posts (Question, comments, suggestions, and review)
*/
'getMixedPosts': function (options) {
	//alert("in display posts db controller");
		// send request to database
						
		Ext.util.JSONP.request({
				url: 'http://yangjustine.startlogic.com/flytalk/flytalk1/db/dbFlytalk.php',
				callbackKey: 'callback',
				params: {
               			// method: 'getFlightPost',	 // using this parameter
						 method: 'getTerminalPost',	
            	},
				success: function() { Ext.Msg.alert('Success'); },
				failure: function() { Ext.Msg.alert('fail');},
				callback: function(data){
					//alert(data.results[0].from_user);
					//alert(data.results.length);
					
					var store = new Ext.data.JsonStore({
						model : 'MixedPostModel',
					});
				
					// load data into store
					//store.loadData(data.results);
					
					// bind store to list
					//alert(FlyTalk.views.ColumnView.tweetList);
					FlyTalk.views.ColumnView.tweetList.update(data.results); 
			
					//FlyTalk.views.TalkView.doLayout();			
					FlyTalk.views.mainView.setActiveItem(FlyTalk.views.TalkView, {type: 'slide', direction: 'right'});
					
				}
		});
},

/**
* DESCRIPTION: search database according to the input submitted
* PARAMETERS: 
* 		input - user input
*       next - next page to display
*       list - list to display the search results
* RESULT: 
* 		populate the provided list with search results and direct to next page
* 		if there are official content in search result, will place those at the top
*/
'searchDB': function (options) {},

});

/**
* DESCRIPTION: get list of tasks that the user can help out
* PARAMETERS: 
* 		uid - user id
*       next - next page to display
*       list - list to display the search results
* RESULT: populate the provided list with help out and direct to next page
*/
'getHelpList': function (options) {},

});

/**
* DESCRIPTION: get user's notifications
* PARAMETERS: 
* 		uid - user id
*       next - next page to display
*       list - list to display the search results
* RESULT: 
* 		populate the provided list with notifications and direct to next page
* 		notification will start with official, then 2 help out + 1 see more and recent notifications
*/
'getNotification': function (options) {},

});

FlyTalk.controllers.dbController = Ext.ControllerManager.get('dbController');